home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Tools & Apps / OS⁄Toolbox / System 7 Icons Interfaces / Icons.p < prev    next >
Encoding:
Text File  |  1992-08-28  |  8.2 KB  |  299 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        Icons.p
  3.  
  4.     Contains:    Pascal interfaces for icon-handling routines
  5.  
  6.     Copyright:    © 1990, 1992 by Apple Computer, Inc., all rights reserved.
  7.  
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.  UNIT Icons;
  17.  INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingIcons}
  21. {$SETC UsingIcons := 1}
  22.  
  23. {$I+}
  24. {$SETC UsingIcons := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26.  
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30.  
  31. {$IFC UNDEFINED UsingQuickdraw}
  32. {$I $$Shell(PInterfaces)QuickDraw.p}
  33. {$ENDC}
  34.  
  35. {$SETC UsingIncludes := UsingIcons}
  36.  
  37. CONST
  38.  
  39. { The following are icons for which there are both icon suites and SICNs. }
  40. genericDocumentIconResource = -4000;
  41. genericStationeryIconResource = -3985;
  42. genericEditionFileIconResource = -3989;
  43. genericApplicationIconResource = -3996;
  44. genericDeskAccessoryIconResource = -3991;
  45.  
  46. genericFolderIconResource = -3999;
  47. privateFolderIconResource = -3994;
  48.  
  49. floppyIconResource = -3998;
  50. trashIconResource = -3993;
  51.  
  52. { The following are icons for which there are SICNs only. }
  53. desktopIconResource = -3992;
  54. openFolderIconResource = -3997;
  55. genericHardDiskIconResource = -3995;
  56. genericFileServerIconResource = -3972;
  57. genericSuitcaseIconResource = -3970;
  58. genericMoverObjectIconResource = -3969;
  59.  
  60. { The following are icons for which there are icon suites only. }
  61. genericPreferencesIconResource = -3971;
  62. genericQueryDocumentIconResource = -16506;
  63. genericExtensionIconResource = -16415;
  64.  
  65. systemFolderIconResource = -3983;
  66. appleMenuFolderIconResource = -3982;
  67. startupFolderIconResource = -3981;
  68. ownedFolderIconResource = -3980;
  69. dropFolderIconResource = -3979;
  70. sharedFolderIconResource = -3978;
  71. mountedFolderIconResource = -3977;
  72. controlPanelFolderIconResource = -3976;
  73. printMonitorFolderIconResource = -3975;
  74. preferencesFolderIconResource = -3974;
  75. extensionsFolderIconResource = -3973;
  76.  
  77. fullTrashIconResource = -3984;
  78.  
  79. large1BitMask = 'ICN#';
  80. large4BitData = 'icl4';
  81. large8BitData = 'icl8';
  82. small1BitMask = 'ics#';
  83. small4BitData = 'ics4';
  84. small8BitData = 'ics8';
  85. mini1BitMask = 'icm#';
  86. mini4BitData = 'icm4';
  87. mini8BitData = 'icm8';
  88.  
  89.  
  90.     { IconAlignmentType values    }
  91. atNone                =    $0;
  92. atVerticalCenter    =    $1;
  93. atTop                =    $2;
  94. atBottom            =    $3;
  95. atHorizontalCenter    =    $4;
  96. atAbsoluteCenter    =    (atVerticalCenter + atHorizontalCenter);
  97. atCenterTop            =    (atTop + atHorizontalCenter);
  98. atCenterBottom        =    (atBottom + atHorizontalCenter);
  99. atLeft                =    $8;
  100. atCenterLeft        =    (atVerticalCenter + atLeft);
  101. atTopLeft            =    (atTop + atLeft);
  102. atBottomLeft        =    (atBottom + atLeft);
  103. atRight                =    $C;
  104. atCenterRight        =    (atVerticalCenter + atRight);
  105. atTopRight            =    (atTop + atRight);
  106. atBottomRight        =    (atBottom + atRight);
  107.  
  108.     { IconTransformType values }
  109. ttNone                =    $0;
  110. ttDisabled            =    $1;
  111. ttOffline            =    $2;
  112. ttOpen                =    $3;
  113. ttLabel1            =    $0100;
  114. ttLabel2            =    $0200;
  115. ttLabel3            =    $0300;
  116. ttLabel4            =    $0400;
  117. ttLabel5            =    $0500;
  118. ttLabel6            =    $0600;
  119. ttLabel7            =    $0700;
  120. ttSelected            =    $4000;
  121. ttSelectedDisabled    =    (ttSelected + ttDisabled);
  122. ttSelectedOffline    =    (ttSelected + ttOffline);
  123. ttSelectedOpen        =    (ttSelected + ttOpen);
  124.     
  125.     { IconSelectorValue masks }
  126. svLarge1Bit            =    $00000001;
  127. svLarge4Bit            =    $00000002;
  128. svLarge8Bit            =    $00000004;
  129. svSmall1Bit            =    $00000100;
  130. svSmall4Bit            =    $00000200;
  131. svSmall8Bit            =    $00000400;
  132. svMini1Bit            =    $00010000;
  133. svMini4Bit            =    $00020000;
  134. svMini8Bit            =    $00040000;
  135. svAllLargeData        =    $000000ff;
  136. svAllSmallData        =    $0000ff00;
  137. svAllMiniData        =    $00ff0000;
  138. svAll1BitData        =    (svLarge1Bit + svSmall1Bit + svMini1Bit);
  139. svAll4BitData        =    (svLarge4Bit + svSmall4Bit + svMini4Bit);
  140. svAll8BitData        =    (svLarge8Bit + svSmall8Bit + svMini8Bit);
  141. svAllAvailableData    =    $ffffffff;
  142.     
  143. TYPE
  144.     IconAction            =    ProcPtr;    {
  145.                                             FUNCTION IconAction(theType: ResType;
  146.                                                         VAR theIcon: Handle;
  147.                                                         yourDataPtr: Ptr): OSErr;
  148.                                         }
  149.                                         
  150.     IconGetter            =    ProcPtr;    {
  151.                                             FUNCTION IconGetter(theType: ResType;
  152.                                                         yourDataPtr: Ptr): Handle;
  153.                                         }
  154.  
  155.     IconSelectorValue    =    LONGINT;
  156.     IconAlignmentType    =    INTEGER;
  157.     IconTransformType    =    INTEGER;
  158.  
  159.     FUNCTION PlotIconID(theRect: Rect;
  160.                         align: IconAlignmentType;
  161.                         transform: IconTransformType;
  162.                         theResID: INTEGER): OSErr;
  163.         INLINE    $303C, $0500, $ABC9;
  164.     
  165.     FUNCTION NewIconSuite(VAR theIconSuite: Handle): OSErr;
  166.         INLINE    $303C, $0207, $ABC9;
  167.     
  168.     FUNCTION AddIconToSuite(theIconData: Handle;
  169.                             theSuite: Handle;
  170.                             theType: ResType): OSErr;
  171.         INLINE    $303C, $0608, $ABC9;
  172.     
  173.     FUNCTION GetIconFromSuite(VAR theIconData: Handle;
  174.                             theSuite: Handle;
  175.                             theType: ResType): OSErr;
  176.         INLINE    $303C, $0609, $ABC9;
  177.     
  178.     FUNCTION ForEachIconDo(theSuite: Handle;
  179.                             selector: IconSelectorValue;
  180.                             action: IconAction;
  181.                             yourDataPtr: Ptr): OSErr;
  182.         INLINE    $303C, $060A, $ABC9;
  183.     
  184.     FUNCTION GetIconSuite(VAR theIconSuite: Handle;
  185.                             theResID: INTEGER;
  186.                             selector: IconSelectorValue): OSErr;
  187.         INLINE    $303C, $0501, $ABC9;
  188.     
  189.     FUNCTION DisposeIconSuite(theIconSuite: Handle;
  190.                             disposeData: BOOLEAN): OSErr;
  191.         INLINE    $303C, $0302, $ABC9;
  192.     
  193.     FUNCTION PlotIconSuite(theRect: Rect;
  194.                             align: IconAlignmentType;
  195.                             transform: IconTransformType;
  196.                             theIconSuite: Handle): OSErr;
  197.         INLINE    $303C, $0603, $ABC9;
  198.     
  199.     FUNCTION MakeIconCache(VAR theHandle: Handle;
  200.                             makeIcon: IconGetter;
  201.                             yourDataPtr: UNIV Ptr): OSErr;
  202.         INLINE    $303C, $0604, $ABC9;
  203.     
  204.     FUNCTION LoadIconCache(theRect: Rect;
  205.                             align: IconAlignmentType;
  206.                             transform: IconTransformType;
  207.                             theIconCache: Handle): OSErr;
  208.         INLINE    $303C, $0606, $ABC9;
  209.  
  210.     FUNCTION PlotIconMethod(theRect: Rect;
  211.                             align: IconAlignmentType;
  212.                             transform: IconTransformType;
  213.                             theMethod: IconGetter;
  214.                             yourDataPtr: UNIV Ptr): OSErr;
  215.         INLINE $303C, $0805, $ABC9;
  216.     
  217.     FUNCTION GetLabel(labelNumber: INTEGER; VAR labelColor: RGBColor;
  218.                             VAR labelString: Str255): OSErr;
  219.         INLINE $303C, $050B, $ABC9;
  220.     
  221.     FUNCTION PtInIconID(testPt: Point; iconRect: Rect;
  222.                     align: IconAlignmentType; iconID: INTEGER): BOOLEAN;
  223.         INLINE $303C, $060D, $ABC9;
  224.  
  225.     FUNCTION PtInIconSuite(testPt: Point; iconRect: Rect;
  226.                     align: IconAlignmentType;
  227.                     theIconSuite: Handle): BOOLEAN;
  228.         INLINE $303C, $070E, $ABC9;
  229.  
  230.     FUNCTION PtInIconMethod(testPt: Point; iconRect: Rect;
  231.                     align: IconAlignmentType;
  232.                     theMethod: IconGetter; yourDataPtr: Ptr): BOOLEAN;
  233.         INLINE $303C, $090F, $ABC9;
  234.  
  235.     FUNCTION RectInIconID(testRect: Rect; iconRect: Rect;
  236.                     align: IconAlignmentType; iconID: INTEGER): BOOLEAN;
  237.         INLINE $303C, $0610, $ABC9;
  238.  
  239.     FUNCTION RectInIconSuite(testRect: Rect; iconRect: Rect;
  240.                     align: IconAlignmentType;
  241.                     theIconSuite: Handle): BOOLEAN;
  242.         INLINE $303C, $0711, $ABC9;
  243.  
  244.     FUNCTION RectInIconMethod(testRect: Rect; iconRect: Rect;
  245.                     align: IconAlignmentType;
  246.                     theMethod: IconGetter; yourDataPtr: Ptr): BOOLEAN;
  247.         INLINE $303C, $0912, $ABC9;
  248.  
  249.     FUNCTION IconIDToRgn(theRgn: RgnHandle; iconRect: Rect;
  250.                     align: IconAlignmentType; iconID: INTEGER): OSErr;
  251.         INLINE $303C, $0913, $ABC9;
  252.  
  253.     FUNCTION IconSuiteToRgn(theRgn: RgnHandle; iconRect: Rect;
  254.                     align: IconAlignmentType;
  255.                     theIconSuite: Handle): OSErr;
  256.         INLINE $303C, $0914, $ABC9;
  257.  
  258.     FUNCTION IconMethodToRgn(theRgn: RgnHandle; iconRect: Rect;
  259.                     align: IconAlignmentType;
  260.                     theMethod: IconGetter; yourDataPtr: Ptr): OSErr;
  261.         INLINE $303C, $0915, $ABC9;
  262.  
  263.     FUNCTION SetSuiteLabel(theSuite: Handle; theLabel: INTEGER): OSErr;
  264.         INLINE $303C, $0316, $ABC9;
  265.  
  266.     FUNCTION GetSuiteLabel(theSuite: Handle): INTEGER;
  267.         INLINE $303C, $0217, $ABC9;
  268.  
  269.     FUNCTION GetIconCacheData(theCache: Handle; VAR theData: Ptr): OSErr;
  270.         INLINE $303C, $0419, $ABC9;
  271.         
  272.     FUNCTION SetIconCacheData(theCache: Handle; theData: Ptr): OSErr;
  273.         INLINE $303C, $041A, $ABC9;
  274.         
  275.     FUNCTION GetIconCacheProc(theCache: Handle; VAR theProc: IconGetter): OSErr;
  276.         INLINE $303C, $041B, $ABC9;
  277.         
  278.     FUNCTION SetIconCacheProc(theCache: Handle; theProc: IconGetter): OSErr;
  279.         INLINE $303C, $041C, $ABC9;
  280.  
  281.     FUNCTION PlotIconHandle(theRect: Rect; align: INTEGER; transform: INTEGER;
  282.                     theIcon: Handle): OSErr;
  283.         INLINE $303C, $061D, $ABC9;
  284.  
  285.     FUNCTION PlotSICNHandle(theRect: Rect; align: INTEGER; transform: INTEGER;
  286.                     theSICN: Handle): OSErr;
  287.         INLINE $303C, $061E, $ABC9;
  288.  
  289.     FUNCTION PlotCIconHandle(theRect: Rect; align: INTEGER; transform: INTEGER;
  290.                     theCIcon: CIconHandle): OSErr;
  291.         INLINE $303C, $061F, $ABC9;
  292.  
  293. {$ENDC} { UsingIcons }
  294.  
  295. {$IFC NOT UsingIncludes}
  296.  END.
  297. {$ENDC}
  298.  
  299.